import java.util.Scanner;

/**
 * Created With IntelliJ IDEA
 * Description:牛客网:HJ64 MP3光标位置
 * <a href="https://www.nowcoder.com/practice/eaf5b886bd6645dd9cfb5406f3753e15?tpId=37&&tqId=21287&rp=1&ru=/activity/oj&qru=/ta/huawei/question-ranking">...</a>
 * User: DELL
 * Data: 2023-04-18
 * Time: 21:20
 */

//本题主要就是分类讨论,讨论起来情况比较多,但难度不大
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int musicNum = scanner.nextInt();
        String operates = scanner.next();
        if (musicNum <= 4) {
            process1(musicNum, operates);
        } else {
            process2(musicNum, operates);
        }
    }

    private static void process1(int musicNum, String operates) {
        int index = 1;
        for (char operate : operates.toCharArray()) {
            if (operate == 'U') {
                if (index == 1) {
                    index = musicNum;
                } else {
                    index--;
                }
            } else {
                if (index == musicNum) {
                    index = 1;
                } else {
                    index++;
                }
            }
        }
        //打印
        for (int i = 1; i < musicNum; i++) {
            System.out.print(i + " ");
        }
        System.out.println(musicNum);
        System.out.println(index);
    }

    private static void process2(int musicNum, String operates) {
        int leftIndex = 1;
        int rightIndex = 4;
        int curIndex = 1;
        for (char operate : operates.toCharArray()) {
            if (operate == 'U') {  // U 操作
                if (curIndex == leftIndex) { //需要调整窗口
                    if (leftIndex == 1) {
                        leftIndex = musicNum - 3;
                        rightIndex = musicNum;
                        curIndex = musicNum;
                    } else {
                        leftIndex--;
                        rightIndex--;
                        curIndex--;
                    }
                } else { //不需要调整窗口
                    curIndex--;
                }
            } else {  // D 操作
                if (curIndex == rightIndex) {  //需要调整窗口
                    if (rightIndex == musicNum) {
                        leftIndex = 1;
                        rightIndex = 4;
                        curIndex = 1;
                    } else {
                        leftIndex++;
                        rightIndex++;
                        curIndex++;
                    }
                } else {  //不需要调整窗口
                    curIndex++;
                }
            }
        }
        for (int i = leftIndex; i < rightIndex; i++) {
            System.out.print(i + " ");
        }
        System.out.println(rightIndex);
        System.out.println(curIndex);
    }
}